local sk_le__jieyin = fk.CreateSkill {

  name = "sk_le__jieyin",

  tags = {},

}



sk_le__jieyin:addEffect("active", {
  name = "sk_le__jieyin",
  anim_type = "support",
  card_num = 1,
  target_num = 1,
  prompt = "#sk_le__jieyin",
  can_use = function(self, player)
    return player:usedSkillTimes(sk_le__jieyin.name, Player.HistoryPhase) == 0
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and not player:prohibitDiscard(to_select)
  end,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0 and to_select ~= player
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:throwCard(effect.cards, sk_le__jieyin.name, player, player)
    local yes = true
    if not player.dead then
      if player:isWounded() then
        room:recover({
          who = player,
          num = 1,
          recoverBy = player,
          skillName = sk_le__jieyin.name,
        })
      else
        player:drawCards(2, sk_le__jieyin.name)
        yes = false
      end
    end
    if not target.dead then
      if target:isWounded() then
        room:recover({
          who = target,
          num = 1,
          recoverBy = player,
          skillName = sk_le__jieyin.name,
        })
      else
        target:drawCards(2, sk_le__jieyin.name)
        yes = false
      end
    end
    if yes then
      player:setSkillUseHistory(sk_le__jieyin.name, 0, Player.HistoryPhase)
    end
  end,
})

return sk_le__jieyin
